The invention relates to systems and methods for reverse engineering software and more particularly relates to a method and apparatus for pattern-based Flowcharting of source code.
Source code is the most important object of the software engineering process. Significant effort is put into understanding source code through reverse engineering, and in fact understanding source code is the main issue of the reverse engineering process. Many existing tools are available which assist in understanding source code. These include tools which produce listings of source code and cross reference tools. There are many tools available today which are capable of producing various types of graphical representations of source code. These include for example flowcharts which graphically illustrate control flow of individual procedures or functions, and class hierarchy diagrams which show inheritance relations between classes.
In reverse engineering tasks it would be desirable for any graphical diagrams created to have a uniform presentation style which is independent of the individual style of the original author of the source code. The reason is that the person performing the reverse engineering task is usually not the original author of the source code. Also, reverse engineering is usually performed across several software units which have different original authors.
Graphical diagrams usually consist of primitive graphical symbols connected with lines. Existing graphical tools are generally only capable of presenting and manipulating primitive graphical symbols and lines independently. This leads to a situation where graphical diagrams of source code are subject to individual layout style.
It is an object of the invention to obviate or mitigate one or more of the above mentioned disadvantages.
The invention provides systems and methods for extracting information from source code and presenting this information in the form of graphical diagrams which consist of predefined building blocks (called graphical patterns). Each graphical pattern consists of a number of primitive graphical symbols which are graphically arranged and connected with lines. An important characteristic of these graphical patterns is that they may contain predefined places where further patterns can be inserted recursively. These predefined places in the graphical patterns are called nested sockets.
The final appearance of a graphical pattern depends on the patterns inserted into the nested sockets. All layout and editing operations are applied to graphical patterns and not to individual primitive symbols and lines. A particular pattern is represented in the form of a set of formulae for the computation of layout attributes. When a graphical diagram of a particular source code construct is required, the source code entity is first converted into nested patterns and then the layout attribute computations are performed. The graphical diagram is created by further converting the nested patterns into display directives. The display directives when executed by a suitable graphical engine produce the desirable graphical image which can be scaled without re-evaluating layout attributes.